<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="header-wrapper" th:fragment="topbar">
    <header>
        <div class="container">
            <div class="logo-container">
                <!-- Website Logo -->
                <span class="tag-line"><a href="/main"  title="学习生活交流论坛">学习生活交流论坛</a></span>
            </div>
            <!-- Start of Main Navigation -->
            <nav class="main-nav">
                <div class="menu-top-menu-container">
                    <ul id="menu-top-menu" class="clearfix">
                        <li><a style="color: white;font-weight: bold;" th:href="@{/coffee}">支持/帮助/Buy me a coffee</a></li>
                        <li><a hidden id="status" th:text="${session.status}"></a></li>
                        <li><a style="color: white" th:style="${activeUri=='chatting'?'color: white;font-weight: bold;':''}" th:href="${session.loginuser}==null? @{/register}:@{/chatting}" onclick="submit()">讨论区</a></li>
                        <li><a style="color: white" th:style="${activeUri=='category4'?'color: white;font-weight: bold;':''}" th:href="@{/category/4}">刷题板块</a></li>
                        <li><a style="color: white" th:style="${activeUri=='category2'?'color: white;font-weight: bold;':''}" th:href="@{/category/2}">校园周边</a></li>
                        <li><a style="color: white" th:style="${activeUri=='Course'?'color: white;font-weight: bold;':''}" th:href="@{/Course}">课程推荐</a></li>
                        <li><a style="color: white" th:style="${activeUri=='resource'?'color: white;font-weight: bold;':''}" th:href="@{/resource}">资源共享</a></li>
                        <li><a style="color: white" th:style="${activeUri=='main'?'color: white;font-weight: bold;':''}" th:href="@{/main}">全部帖子</a></li>
                        <li><a >通知</a>
                            <ul class="sub-menu" >
                                <li th:each="notice:${session.notices}"><a th:href="@{${notice.href}}" href="/main" th:text="${notice.msg}" ></a></li>
                            </ul>
                        </li>

                        <li><a id="username" th:text="${session.loginuser}==null?'游客':${session.loginuser}"></a>
                            <ul class="sub-menu">
                                <li><a style="color: white" th:style="${activeUri=='userspace'?'color: white;font-weight: bold;':''}" th:action="get" th:href="${session.loginuser}==null? @{/register}:@{/userspace}" >个人中心</a></li>
                                <li th:if="${session.level}==0"><a style="color: white" th:style="${activeUri=='administrators'?'color: white;font-weight: bold;':''}" th:href="${session.loginuser}==null? @{/register}:@{/administrators}" >管理中心</a></li>  <!--th:if="${session.level == 0}"!-->
                                <li><a th:href="@{/}">注销</a></li>
                                <li><a style="color: white" th:style="${activeUri=='setting'?'color: white;font-weight: bold;':''}" th:href="${session.loginuser}==null? @{/register}:@{/setting}">设置</a></li>
                                <!--                                                                                <li><a href="">Default Skin</a></li>-->
                            </ul>
                        </li>

                    </ul>
                </div>
            </nav>
            <!-- End of Main Navigation -->
        </div>
    </header>
</div>
</body>
</html>
<script>
    function submit(){
        var str = document.getElementById("username").innerHTML;
        setInfo(str);
        var str1 = document.getElementById("status").innerHTML;
        setstatus(str1);
    }
    function setInfo(name) {
        sessionStorage.setItem("username", name);
    }
    //储存数据  
    function setstatus(name) {
        sessionStorage.setItem("status",name);
    }
</script>
